export function resetSize(vm: any) {
	let img_width: string;
	let img_height: string;
	let bar_width: string;
	let bar_height: string;
	// 图片的宽度、高度，移动条的宽度、高度

	const parentWidth = vm.$el.parentNode.offsetWidth || window.innerWidth;
	const parentHeight = vm.$el.parentNode.offsetHeight || window.innerHeight;
	if (vm.imgSize.width.includes('%')) {
		img_width = `${(Number.parseInt(vm.imgSize.width, 10) / 100) * parentWidth}px`;
	} else {
		img_width = vm.imgSize.width;
	}

	if (vm.imgSize.height.includes('%')) {
		img_height = `${(Number.parseInt(vm.imgSize.height, 10) / 100) * parentHeight}px`;
	} else {
		img_height = vm.imgSize.height;
	}

	if (vm.barSize.width.includes('%')) {
		bar_width = `${(Number.parseInt(vm.barSize.width, 10) / 100) * parentWidth}px`;
	} else {
		bar_width = vm.barSize.width;
	}

	if (vm.barSize.height.includes('%')) {
		bar_height = `${(Number.parseInt(vm.barSize.height, 10) / 100) * parentHeight}px`;
	} else {
		bar_height = vm.barSize.height;
	}

	return {
		imgWidth: img_width,
		imgHeight: img_height,
		barWidth: bar_width,
		barHeight: bar_height
	};
}
